home *** CD-ROM | disk | FTP | other *** search
/ SPACE 2 / SPACE - Library 2 - Volume 1.iso / misc / 40 / shk3.c < prev    next >
Encoding:
C/C++ Source or Header  |  1986-07-17  |  1.6 KB  |  61 lines

  1. /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
  2. /* shk.c - version 1.0.3 */
  3.  
  4. #include "hack.h"
  5. #include    "mfndpos.h"
  6. #include    "mkroom.h"
  7. #include    "eshk.h"
  8.  
  9. #define    ESHK(mon)    ((struct eshk *)(&(mon->mextra[0])))
  10. #define    NOTANGRY(mon)    mon->mpeaceful
  11. #define    ANGRY(mon)    !NOTANGRY(mon)
  12.  
  13. extern char plname[], *xname();
  14. extern struct obj *o_on(), *bp_to_obj();
  15.  
  16. /* Descriptor of current shopkeeper. Note that the bill need not be
  17.    per-shopkeeper, since it is valid only when in a shop. */
  18. extern struct monst *shopkeeper;
  19. extern struct bill_x *bill;
  20. extern int shlevel;    /* level of this shopkeeper */
  21. extern       struct obj *billobjs;    /* objects on bill with bp->useup */
  22.                 /* only accessed here and by save & restore */
  23. extern long int total;        /* filled by addupbill() */
  24. extern long int followmsg;    /* last time of follow message */
  25.  
  26. /*
  27.     invariants: obj->unpaid iff onbill(obj) [unless bp->useup]
  28.         obj->quan <= bp->bquan
  29.  */
  30.  
  31.  
  32. extern char shtypes[];
  33.  
  34. extern char *shopnam[];
  35.  
  36. extern char *shkname();
  37.  
  38. extern struct bill_x *onbill();
  39.  
  40. dopay2(shkp)
  41. register struct monst *shkp;
  42. {
  43.     long ltmp;
  44.     pline("But in order to appease %s,",
  45.         amonnam(shkp, "angry"));
  46.     if(u.ugold >= 1000){
  47.         ltmp = 1000;
  48.         pline(" you give him 1000 gold pieces.");
  49.     } else {
  50.         ltmp = u.ugold;
  51.         pline(" you give him all your money.");
  52.     }
  53.     pay(ltmp, shkp);
  54.     if(strncmp(ESHK(shkp)->customer, plname, PL_NSIZ)
  55.        || rn2(3)){
  56.         pline("%s calms down.", Monnam(shkp));
  57.         NOTANGRY(shkp) = 1;
  58.     } else    pline("%s is as angry as ever.",
  59.             Monnam(shkp));
  60. /*end dopay2*/}
  61.